<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:template match="/">
		<BusinessTransactionResponse>
			<xsl:for-each select="insupost-response">
				<BusinessTransaction>
					<kind> New Underwriting</kind>
					<transationId>
						<xsl:value-of select="response-head/trans-id"/>
					</transationId>
					<transationDate>
						<xsl:value-of select="concat(substring(string(response-head/trans-date),1,4),'-',substring(string(response-head/trans-date),5,2),'-',substring(string(response-head/trans-date),7,2),' ',
substring(string(response-head/trans-time),1,2),':',substring(string(response-head/trans-time),3,2),':',substring(string(response-head/trans-time),5,2)
)"/>
					</transationDate>
					<partnerCode> WEIXIN </partnerCode>
				</BusinessTransaction>
				<TransactionResult>
					<xsl:choose>
						<xsl:when test="/insupost-response/response-head/trans-result = 0">
							<resultCode>SUCCESS</resultCode>
						</xsl:when>
						<xsl:otherwise>
							<resultCode>FAILURE</resultCode>
							<ResultInfos>
								<xsl:for-each select="response-head/validity-errors">
									<ResultInfo>
										<infoCode>
											<xsl:value-of select="validity-error/error-code"/>
										</infoCode>
										<infoCodeMessage>
											<xsl:value-of select="validity-error/error-desc"/>
										</infoCodeMessage>
									</ResultInfo>
								</xsl:for-each>
							</ResultInfos>
						</xsl:otherwise>
					</xsl:choose>
				</TransactionResult>
			</xsl:for-each>
		</BusinessTransactionResponse>
	</xsl:template>
</xsl:stylesheet>
